package aad.storyboard.model;

import java.util.ArrayList;
import java.util.Observable;

public abstract class EffectAnimation extends Animation{
	
	ArrayList <GraphicalObject> graphicalObjects=new ArrayList <GraphicalObject>();
	
	public EffectAnimation(int duration){
		super(duration);
		graphicalObjects = new ArrayList<GraphicalObject>();	
		
	}
	
	public EffectAnimation(int duration, int t){
		super (duration, t);
		graphicalObjects = new ArrayList<GraphicalObject>();
		
	}
	
	public void addGraphicalObject(GraphicalObject object)
	{
		graphicalObjects.add(object);
	}
	
	public ArrayList <GraphicalObject> getGraphicalObjects()
	{
		return graphicalObjects;
	}
	
	
	@Override
	public void update(Observable frc, Object arg){
		if(this.currentDuration>this.intervals){
			this.stop();			
		}
		if(this.isActive()){			
			this.animate();			
			this.currentDuration ++;
		}
	}

	

}
